<template>
    <div class="title">{{ titleText }}</div>
    <template v-if="isSet">
        <div class="img">
            <up-load @upload="upload" :imgUrl="imgList" />
        </div>
        <div class="disc">描述</div>
        <el-input :autosize="{ minRows: 5 }" type="textarea" :placeholder="placeholder" @input="handlerInput" :model-value="store.treeSelectNode.remark || remark" />
    </template>
    <template v-else>
        <div class="img">
            <img :src="item.url" v-for="item in imgList" />
        </div>
        <div class="disc-one">
            <span>故障描述：</span>
            <span>{{ remark }}</span>
        </div>
    </template>
</template>

<script setup>
import upLoad from "@/components/upLoad.vue";
import { useReportOrderDetail } from "@/store/reportOrderDetail.js";

const props = defineProps({
    titleText: {
        type: String,
        default: ""
    },
    isSet: {
        type: Boolean,
        default: true
    },
    imgList: {
        type: Array,
        default: []
    },
    remark: {
        type: String,
        default: ""
    },
    placeholder: {
        type: String,
        default: ""
    }
});
const emits = defineEmits(["upload", "handlerInput"]);
const store = useReportOrderDetail();

const handlerInput = (value) => {
    emits("handlerInput", value);
};
const upload = (imgList) => {
    emits("upload", imgList);
};
</script>

<style lang="scss" scoped>
.title {
    margin-bottom: 16px;
    font-weight: 600;
    color: #1b3646;
}
.disc {
    margin: 16px 0;
    font-size: 14px;
    color: #595959;
}
.img {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    img {
        margin-right: 16px;
        width: 122px;
        height: 122px;
    }
}
.disc-one {
    margin-top: 16px;
    font-size: 14px;
    span {
        &:first-child {
            color: #8c8c8c;
        }
        &:last-child {
            color: #595959;
        }
    }
}
</style>
